package cn.cupk.logsystem.service.serviceImpl;

import cn.cupk.logsystem.mapper.AdministratorMapper;
import cn.cupk.logsystem.pojo.Administrator;
import cn.cupk.logsystem.service.AdministratorService;
import cn.cupk.logsystem.utils.Md5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AdministratorServiceImpl implements AdministratorService {

    @Autowired
    private AdministratorMapper administratorMapper;

    @Override
    public Administrator findAdminByUsername(String username) {

        return administratorMapper.selectAdministratorByUsername(username);
    }

    @Override
    public void insertAdministrator(String username, String password) {

        String md5String = Md5Util.getMD5String(password);

        administratorMapper.insertAdministrator(username, md5String);
    }
}